@extends("admin.layouts.main")
<style>
    .card-body .form-group {
        width: 28%;
    }
    @media screen and (max-width: 1024px) {
        .card-body .form-group {
            width: 100% !important;
        }
        .my-div{
            width:90%;
        }
    }
    .show-item {
        top: 40px;
        width: 75%;
        right: 15px;
        z-index: 10;
        background: white;
        overflow: hidden;
        display: none;
    }
    .showMsg li {
        padding-bottom: 5px;
        cursor: pointer;
        padding: 10px 8px;
        margin: 2px 0;
    }
    .showMsg li:hover {
        background-color: #f2f2f2;
    }
    input::-webkit-input-placeholder { /* WebKit browsers */
        font-size: 13px;
    }
    input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
        font-size: 13px;
    }
    input:-ms-input-placeholder { /* Internet Explorer 10+ */
        font-size: 13px;
    }
    .card{
        min-width: 1024px;
    }
</style>
@section("content")
<div class="container-fiuld p-3" id="app">
    <div class="card">
        <div class="card-body">
            <div class="pt-2 pb-2 d-flex justify-content-between align-items-center" style="background-color:#f2f2f2;font-size:18px;">
                <h4 class="pl-2">修改公告</h4>
                <a href="{{ route('announ.index') }}" class="btn btn-link">返回</a>
            </div>
            <form class="layui-form mt-3">
                <div class="form-group w-50 row align-items-center">
                    <label class="col-lg-3 text-right" style="line-height:30px">标题:</label>
					<div class="col-9">
                    <input type="text" class="form-control w-100" name="title" value="{{ $announ->title }}" required lay-verify="required" placeholder="请输入标题" />
					</div>
                </div>
				<div class="form-group w-50 row align-items-center">
                    <label class="col-lg-3 text-right" style="line-height:30px">内容:</label>
					<div class="col-9">
					<textarea class="form-control w-100" name="content" id="content" lay-verify="required" placeholder="请输入内容" rows="20">{{ $announ->content }}</textarea>
					</div>
                </div>
				@if(in_array('announ.update', $menuRule))
                <div class="row">
                    <div class="offset-3 col-lg-9">
                    <button class="layui-btn" lay-submit lay-filter="update-announ" data-url="{{ route('announ.update', ['id' => $announ->id]) }}" data-type="POST">提交</button>
                    <button type="reset" class="btn btn-danger">重置</button>
                    </div>
                </div
				@endif
            </form>
        </div>
    </div>
</div>
@endsection
@section("js")
<script src="{{ asset('kindeditor/kindeditor-min.js') }}"></script>
<script src="{{ asset('kindeditor/lang/zh_CN.js') }}"></script>
<script>
	layui.use(['form', 'ori'], function () {
            var form = layui.form,
                ori = layui.ori,
                $ = layui.$;
            form.on('submit(update-announ)', function (data) {
                ori.submit($(this), data.field, function () {
					window.location.href = "{{ route('announ.index') }}";
                });
                return false;
            });
        });
</script>
<script>
	// 编辑器
	var uploadJson = '';
	var fileManagerJson = '';
	var editor;
	KindEditor.ready(function (K) {
		editor = K.create("#content", {
			allowFileManager: true,
			uploadJson: uploadJson,
			fileManagerJson: fileManagerJson,
			afterBlur: function () {
				this.sync();
			}
		});
	});
</script>
@endsection
